<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #a1{
                position: fixed;
                bottom: 20px;
                right: 20px;
            }
        #d1{
            width: 100px;
            height: 100px;
            background: blue;
        }
        #d2{
            width: 100px;
            height: 2000px;
            background: red;
        }
        #d3{
            margin-top: 100px;
            border-top: 2px solid red;
        }
        .hib{
            display: none;
        }
    </style>
</head>
<body>
<a name="H"></a>
<div id="d1">

</div>
<div id="d2">
    <div id="d3">

    </div>
</div>
<a href="#H" id="a1" class="hib">回到顶部</a>

<script src="jquery.js"></script>
<script>
    $(window).scroll(function(){
        if ($(window).scrollTop() >= 200){
            $("#a1").removeClass("hib");
        }else{
            $("#a1").addClass("hib");
        }
    });
</script>
</body>
</html>